﻿//Copyright (c) 2010, Andreas Grünwald
//All rights reserved.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Input;
using yaTDL.Core.Properties;

namespace yaTDL.Core.MVVM
{
    public class MainWindowViewModel : ViewModelBase
    {

        #region Fields
  
        Visibility _syncIndicatorVisibility = Visibility.Collapsed;

        #endregion


        #region Properties

        public Visibility SyncIndicatorVisibilty
        {
            get { return _syncIndicatorVisibility; }
            set
            {
                if (value != _syncIndicatorVisibility)
                {
                    _syncIndicatorVisibility = value;
                    RaisePropertyChanged("SyncIndicatorVisibilty");
                }
            }
        }

        #endregion


        #region Constructor and private methods

        public MainWindowViewModel()
        {
            TaskStore.SyncService.ActionStarted += new EventHandler(SyncService_ActionStarted);
            TaskStore.SyncService.ActionCompleted += new EventHandler(SyncService_ActionCompleted);
            ViewManager.ShowView(new MainPageViewModel());
        }
        

        void SyncService_ActionStarted(object sender, EventArgs e)
        {
            SyncIndicatorVisibilty = Visibility.Visible;
        }

        void SyncService_ActionCompleted(object sender, EventArgs e)
        {
            SyncIndicatorVisibilty = Visibility.Collapsed;
        }

        #endregion

    }
}
